<template>
  <div>
    <div>
      
      <el-row style="margin-bottom:10px;display:flex;align-items:center">
        <el-col :span="8" >
          <h4 style="height:40px;line-height:40px"> 商品审核 </h4>
        </el-col>
        <el-col :span="16" style="text-align:right">
          <el-input v-model="sheachValue" style="width:300px" placeholder="输入搜索内容"></el-input>
          <el-button type="primary" @click="seachFun">搜索</el-button>
        </el-col>
      </el-row>
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="全部" name="first">
          <Comm-table v-if="navStatus == -1" ref="refData" :navStatus="navStatus"    ></Comm-table>
        </el-tab-pane>

        <el-tab-pane label="待审核" name="second">
          <Comm-table  v-if="navStatus == 0"  ref="refData"  :navStatus="navStatus"     ></Comm-table>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>
<script>
  import CommTable from './CommTable/CommTable'
  export default {
    data() { 
      return {
        activeName: 'first',
        checkleng:'',
        navStatus:-1,
        userRole:JSON.parse(sessionStorage.getItem('userSolt')),
        sheachValue:'',
      }
    },
    components:{
      CommTable
    },
     mounted() {
      var obj = document.getElementById('centerbox')
      obj.addEventListener('scroll', this.handleScroll,true)
    },
    destroyed(){
      var obj = document.getElementById('centerbox')
      obj.removeEventListener('scroll', this.handleScroll,true)
    },
    methods: {
      handleScroll() {
        var scollobj = document.getElementById('centerbox');
        var scrollTop = scollobj.scrollTop;
        const obj = document.getElementById('tab-first');
        const myobj = obj.parentNode.parentNode;
        if(scrollTop> 32){
          myobj.style.position = 'fixed';
          myobj.style.top = 0;
        } else {
          myobj.style.position = 'relative';
        }
      },
      handleClick(tab, event) {
        this.navStatus = Number(tab.index) -1;
      },

      seachFun(){
        
        this.$refs.refData.getList(this.sheachValue)
      }
    }
  }
</script>